package com.okami.domain.onlineshop;

import com.okami.common.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.util.Set;

/**
 * @author: TanJingyu
 * @create: 2020-12-22 14:46
 **/
@EqualsAndHashCode(callSuper = true)
@Entity
@Table
@Data
@Accessors(chain = true)
public class Categories extends AbstractEntity<Long> {
    private String name;
    @OneToOne
    @JoinColumn(name = "parent_id", referencedColumnName = "id")
    private Categories parentId;

    @OneToMany
    @JoinTable(name = "category_brand", joinColumns = @JoinColumn(name = "cid"), inverseJoinColumns = @JoinColumn(name = "bid"))
    private Set<Brand> brands;

}
